package org.pentaho.cubic.client.service;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

public class CubicServiceCache {

  public static ICubicServiceAsync service = null;

  public static ICubicServiceAsync getService() {
	//System.out.println("Get CubicService ");
    if (service == null) {
      service = (ICubicServiceAsync) GWT.create(ICubicService.class);
      ServiceDefTarget endpoint = (ServiceDefTarget) service;
      String moduleRelativeURL = GWT.getHostPageBaseURL() + "/CubicService"; //$NON-NLS-1$
      //String moduleRelativeURL = GWT.getModuleBaseURL() + "CubicService"; //$NON-NLS-1$
      endpoint.setServiceEntryPoint(moduleRelativeURL);
    }
    return service;
  }
}